package com.jumi.microservice.material.controller;

import com.jumi.microservice.common.base.BaseController;
import com.jumi.microservice.common.base.dto.ResponseResult;
import com.jumi.microservice.material.domain.JmDictDTO;
import com.jumi.microservice.material.domain.JmDictValue;
import com.jumi.microservice.material.service.JmDictService;
import com.jumi.microservice.material.service.JmDictValueService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ssk
 * @create 2020/8/13 17:18
 **/
@Api(tags = {"【基础资料】字典接口"})
@RestController
@RequestMapping("/dict")
public class DictController extends BaseController {
    private static final Logger logger = LoggerFactory.getLogger(DictController.class);
    @Resource
    private JmDictService jmDictService;

    @Resource
    private JmDictValueService dictValueService;

    @ApiOperation("根据字典CODE查询CODE值列表")
    @ApiImplicitParam(name = "dictCode", value = "字典CODE值", required = true)
    @GetMapping("/findListByDictCode")
    public ResponseResult findListByDictCode(String dictCode) {
        List<JmDictValue> list = dictValueService.findListByDictCode(dictCode);
        return ResponseResult.success(list);
    }

    /**
     * @Description: 查询仓库库存变动类型
     * @Param
     * @Return {@link ResponseResult}
     * @Throws
     * @Author Abel Yang
     * @Date 2020/9/11/011 9:35
     */
    @ApiImplicitParams(value = {})
    @ApiOperation("查询仓库库存变动类型")
    @GetMapping("/getStockChangeTypes")
    public ResponseResult getStockChangeTypes() {
        List<JmDictDTO> list = jmDictService.getStockChangeTypes();
        return ResponseResult.success(list);
    }
}
